package com.levi.pay.enums;

import com.lly835.bestpay.enums.BestPayPlatformEnum;
import com.lly835.bestpay.enums.BestPayTypeEnum;
import lombok.Getter;

import java.util.Objects;

/**
 * @author shentong
 * @since 2022/3/20 5:46 PM
 */
@Getter
public enum PayPlatformEnum {
    WX(1,"微信"),
    ALIPAY(2,"支付宝支付"),
    ;

    private final Integer code;
    private final String name;

    PayPlatformEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static Integer getPayPlatformStatus(BestPayTypeEnum bestPayTypeEnum) {
        for (PayPlatformEnum value : PayPlatformEnum.values()) {
            if (Objects.equals(value.name(), bestPayTypeEnum.getPlatform().name())) {
                return value.code;
            }
        }
        throw new RuntimeException("支付方式有误！");
    }

}
